home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_360 / uucp / uucp0.lzh / src / uuser / misc.c < prev    next >
C/C++ Source or Header  |  1990-04-02  |  2KB  |  85 lines

  1.  
  2. /*
  3.  *  MISC.C  - support routines - Phillip Lindsay (C) Commodore 1986
  4.  *  You may freely distribute this source and use it for Amiga Development -
  5.  *  as long as the Copyright notice is left intact.
  6.  *
  7.  *  $Header: Beta:src/uucp/src/uuser/RCS/misc.c,v 1.1 90/02/02 12:10:13 dillon Exp Locker: dillon $
  8.  *
  9.  *  (C) Copyright 1989-1990 by Matthew Dillon,  All Rights Reserved.
  10.  *
  11.  * 30-SEP-86
  12.  *
  13.  *  major modifications by Matthew Dillon for my PIPE: and other devices,
  14.  *  but basic theorem still Phil's.
  15.  */
  16.  
  17. #include <exec/types.h>
  18. #include <exec/nodes.h>
  19. #include <exec/lists.h>
  20. #include <exec/ports.h>
  21. #include <libraries/dos.h>
  22. #include <libraries/dosextens.h>
  23. #include "protos.h"
  24.  
  25. typedef struct Node NODE;
  26.  
  27. extern void returnpkt();
  28.  
  29. void
  30. returnpktplain(packet, myproc)
  31. struct DosPacket *packet;
  32. struct Process *myproc;
  33. {
  34.     returnpkt(packet, myproc, packet->dp_Res1, packet->dp_Res2);
  35. }
  36.  
  37.  
  38. void
  39. returnpkt(packet, myproc, res1, res2)
  40. register struct DosPacket *packet;
  41. struct Process *myproc;
  42. long res1, res2;
  43. {
  44.     struct Message *mess;
  45.     struct MsgPort *replyport;
  46.  
  47.     packet->dp_Res1         = res1;
  48.     packet->dp_Res2         = res2;
  49.     replyport             = packet->dp_Port;
  50.     mess             = packet->dp_Link;
  51.     packet->dp_Port         = &myproc->pr_MsgPort;
  52.     mess->mn_Node.ln_Name    = (char *)packet;
  53.     mess->mn_Node.ln_Succ    = NULL;
  54.     mess->mn_Node.ln_Pred    = NULL;
  55.     PutMsg(replyport, mess);
  56. }
  57.  
  58.  
  59. /*
  60.  * taskwait() ... Waits for a message to arrive at your port and
  61.  *   extracts the packet address which is returned to you.
  62.  */
  63.  
  64. struct DosPacket *
  65. taskwait(myproc)
  66. struct Process *myproc;
  67. {
  68.     struct MsgPort *myport;
  69.     struct Message *mymess;
  70.  
  71.     myport = &myproc->pr_MsgPort;
  72.     WaitPort(myport);
  73.     mymess = (struct Message *)GetMsg(myport);
  74.     return((struct DosPacket *)mymess->mn_Node.ln_Name);
  75. }
  76.  
  77. taskpktrdy(myproc)
  78. struct Process *myproc;
  79. {
  80.     if (((NODE *)myproc->pr_MsgPort.mp_MsgList.lh_Head)->ln_Succ == NULL)
  81.     return(0);
  82.     return(1);
  83. }
  84.  
  85.